Setting up an RStudio project
1 Using RStudio on posit.cloud
Go to https://posit.cloud/. You’ll have to create an account if you don’t already have one.
The free account on posit.cloud gives you 25 hours of computing time every month.
The computing time gets used up when you are working in your project, but the clock can sometimes carry on ticking even after you’ve closed your browser tab.
To minimise the amount you of computing time you use up, make sure to restart R before you close your browser tab or window. Do this by clicking Session > Restart R from the RStudio menu bar.
↓ Click the New Project button and then New RStudio Project
↓ While you’re waiting for the project to deploy, rename it by clicking Untitled Project and typing a new name
↓ Make sure the data file(s) are saved somewhere on your hard drive
↓ Click on the Upload button in the Files pane
↓ In the popup window, click on the grey Browse button and select your data file(s) to upload them to the project
↓ Click on the New file button and select R Script
↓ Click the Save button
↓ In the popup window, type a name for your script in the File name field and click Save
You’ll need to do this every time you create a new RStudio project in posit.cloud
↓ Click Tools > Global Options from the RStudio menu bar
↓ In the General > Basic tab
Uncheck:
Restore .RData into workspace on startup
Always save history (even when not saving .RData)
Set Save workspace to .RData on exit to “Never”.
This tab should now look like this:
2 Using RStudio Desktop
↓ Download R from CRAN (Windows) or CRAN (MacOS) and RStudio Desktop (free version) from https://posit.co/download/rstudio-desktop/.
↓ Install R
↓ Install RStudio Desktop
↓ Open RStudio Desktop
You’ll only need to do this once after you install RStudio Desktop
↓ Click Tools > Global Options from the RStudio menu bar
↓ In the General > Basic tab
Uncheck:
Restore most recently opened project on startup
Restore .RData into workspace on startup
Always save history (even when not saving .RData)
Set Save workspace to .RData on exit to “Never”.
This tab should now look like this:
↓ Click the New Project button
↓ In the popup window, select New Directory
↓ Select New Project
↓ Type a name into the Directory name field (this will be the name of your new project) and click Browse to navigate to the folder where you want to put the project (e.g. your Desktop)
You should now see a new folder appear in the location you chose in the previous step (e.g. on your Desktop). This is your new project folder.
↓ Make sure the data file(s) are saved somewhere on your hard drive
↓ Copy or drag them into your RStudio project folder
↓ Click on the New file button and select R Script
↓ Click the Save button
↓ In the popup window, type a name for your script in the File name field and click Save. Here I’ve called mine “script”
Now your project folder should contain an RStudio project file, an R script, and your dataset. If you want to work on this RStudio project, don’t open R or RStudio, instead open the RStudio project file from this folder.